home *** CD-ROM | disk | FTP | other *** search
/ Champak 66 / Vol 66.iso / games / bluep.swf / scripts / __Packages / Bullet.as next >
Text File  |  2013-04-24  |  2KB  |  59 lines

  1. class Bullet extends MovieClip
  2. {
  3.    function Bullet()
  4.    {
  5.       super();
  6.       this.moveX = 0;
  7.       this.moveY = 0;
  8.       this._damage = 1;
  9.       this._holdMovement = false;
  10.    }
  11.    function SetMovement(myX, myY)
  12.    {
  13.       this.moveX = myX;
  14.       this.moveY = myY;
  15.    }
  16.    function onEnterFrame()
  17.    {
  18.       if(this._holdMovement == false)
  19.       {
  20.          this._x += this.moveX;
  21.          this._y += this.moveY;
  22.          this.outOfBounds();
  23.          if(this._enemy)
  24.          {
  25.             this.ifHitAvatar();
  26.          }
  27.       }
  28.    }
  29.    function ifHitAvatar()
  30.    {
  31.       if(this.hitTest(_root.pointer.pointerBody))
  32.       {
  33.          if(_root.playerLives >= 2)
  34.          {
  35.             var _loc4_ = "shield_hits2" + _root.getNextHighestDepth();
  36.             var _loc5_ = 1 + Math.floor(Math.random() * 360);
  37.             _root.attachMovie("shield_hits2",_loc4_,_root.getNextHighestDepth());
  38.             _root[_loc4_]._rotation = _root.pointer._rotation + _loc5_;
  39.             _root[_loc4_]._x = this._x;
  40.             _root[_loc4_]._y = this._y;
  41.          }
  42.          this.removeCallback(this._name);
  43.          this.removeMovieClip();
  44.          if(!_global.shieldOn)
  45.          {
  46.             _root.adjustLives();
  47.          }
  48.       }
  49.    }
  50.    function outOfBounds()
  51.    {
  52.       if(this._x < -50 || this._x > 550 || this._y < -50 || this._y > 550 || _global.pauseClicked)
  53.       {
  54.          this.removeCallback(this._name);
  55.          this.removeMovieClip();
  56.       }
  57.    }
  58. }
  59.